package org.androidpush.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import org.androidpush.R;
import org.androidpush.activity.CouScoreActivity;
import org.androidpush.activity.ScheduleActivity;
import org.androidpush.activity.SelectCouActivity;
import org.androidpush.activity.SelectCouSigleActivity;
import org.androidpush.activity.SimpleActivity;
import org.androidpush.adapter.MeAdapter;


public class FindFragment extends Fragment {

	private RelativeLayout selectcourse, schedule, tabcoursescore,auditcourse;
	private View view;
	private Intent intent;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.xml_find,container,false);
		Init();
		ButtonOnClickListenerInit();
		return view;
	}

	public void Init() {
		selectcourse = (RelativeLayout) view.findViewById(R.id.id_function_course);
		schedule = (RelativeLayout) view.findViewById(R.id.id_function_scheld);
		tabcoursescore = (RelativeLayout) view.findViewById(R.id.id_function_score);
		auditcourse = (RelativeLayout) view.findViewById(R.id.id_function_coursed);
		intent = new Intent();
	}

	public void ButtonOnClickListenerInit() {

		selectcourse.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				intent.setClass(view.getContext(), SelectCouActivity.class);
				startActivity(intent);
				getActivity().overridePendingTransition(R.anim.push_left_in,
						R.anim.push_left_out);
			}
		});

		schedule.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				intent.setClass(view.getContext(), ScheduleActivity.class);
				startActivity(intent);
				getActivity().overridePendingTransition(R.anim.push_left_in,
						R.anim.push_left_out);
			}
		});
		
		tabcoursescore.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				intent.setClass(view.getContext(), CouScoreActivity.class);
				startActivity(intent);
				getActivity().overridePendingTransition(R.anim.push_left_in,
						R.anim.push_left_out);
			}
		});

		auditcourse.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(getActivity(), SelectCouSigleActivity.class);
				startActivity(intent);
				getActivity().overridePendingTransition(R.anim.push_left_in,
						R.anim.push_left_out);
			}
		});


	}
}
